package com.juc.forkJoin.forkJoin3;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.ForkJoinTask;

public class Test1 {

	/**
	 * RecursiveTask 执行的任务具有返回值的功能
	 * join() 和get()区别
	 * @param args
	 * @throws ExecutionException 
	 * @throws InterruptedException 
	 */
	public static void main(String[] args) throws InterruptedException, ExecutionException {
		
		MyRecursiveTask task1 = new MyRecursiveTask();
		System.out.println(task1.hashCode());
		ForkJoinPool pool = new ForkJoinPool();
		ForkJoinTask<Integer> task2 = pool.submit(task1);
		System.out.println(task2.hashCode() + "     "  + task2.get());
		Thread.sleep(5000);
	}
}
